
local meta = FindMetaTable( "Player" )

// Return if there's nothing to add on to
if (!meta) then return end

function meta:CheckLimit( str )
	-- No limits in "With Friends Like These" -- Ricky26
	return true
end

function meta:GetTool( mode )

	local wep = self:GetWeapon( "gmod_tool" )
	if (!wep || !wep:IsValid()) then return nil end
	
	local tool = wep:GetToolObject( mode )
	if (!tool) then return nil end
	
	return tool

end

if (SERVER) then

	function meta:SendHint( str, delay )

		self:GetTable().Hints = self:GetTable().Hints or {}
		if (self:GetTable().Hints[ str ]) then return end
		
		self:SendLua( "GAMEMODE:AddHint( '"..str.."', "..delay.." )" )
		self:GetTable().Hints[ str ] = true

	end
	
	function meta:SuppressHint( str )

		self:GetTable().Hints = self:GetTable().Hints or {}
		if (self:GetTable().Hints[ str ]) then return end
		
		self:SendLua( "GAMEMODE:SuppressHint( '"..str.."' )" )
		self:GetTable().Hints[ str ] = true

	end

end

function meta:nFireBullets(bdetails)
	bdetails.Damage = bdetails.Damage / 10
	
	oCallback = bdetails.Callback
	bdetails.Callback = function(attacker, tr, dmginfo)
		if oCallback ~= nil then
			oCallback(attacker, tr, dmginfo)
		end
		
		if tr.Entity:IsValid() and (tr.Entity:IsPlayer() or tr.Entity:IsNPC()) and tr.Entity.Team != self.Team then
			if tr.HitGroup == HITGROUP_HEAD then
				self:GiveCash(10.00)
			else
				self:GiveCash(5.00)
			end
		end
	end

	self:oFireBullets(bdetails)
end

function meta:GiveCash(amount)
	if ( !hook.Call( "PlayerGiveCash", self, self.Cash, amount ) ) then return end	
	self.Cash = self.Cash + amount
end

function meta:HasCash(amount)
	if (hook.Call( "PlayerHasCash", self, self.Cash, amount )) then return true end
	return self.Cash > amount
end

function meta:TakeCash(amount)
	if not hook.Call( "PlayerTakeCash", self, self.Cash, amount ) then return end
	self.Cash = self.Cash - amount
end
